#ifndef TREEITEMMIMIDATA_H
#define TREEITEMMIMIDATA_H

#include <QMimeData>
#include <QTreeWidgetItem>

class TreeItemMimeData :public QMimeData
{
	Q_OBJECT
public:
	TreeItemMimeData() :QMimeData()
	{
		m_pDragItem = NULL;
	}

	~TreeItemMimeData()
	{

	}

	void SetDragData(QString mimeType, QTreeWidgetItem *pItem)
	{
		m_format << mimeType;
		m_pDragItem = pItem;
	}



	QStringList formats() const
	{
		return m_format;
	}

	const QTreeWidgetItem* DragItemData() const
	{
		return m_pDragItem;
	}


protected:

	QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const
	{
		if (mimetype == "ItemMimeData")
		{
			return m_pDragItem;
		}
		else
		{
			return QMimeData::retrieveData(mimetype, preferredType);
		}
	}
private:
	const QTreeWidgetItem   *m_pDragItem;
	QStringList              m_format;
};


#endif
